#pragma once
#include<iostream>
#include<stdbool.h>
using namespace std;
class Date
{
	friend ostream& operator<<(ostream& out, const Date& date);
	friend istream& operator>>(istream& in, Date& date);
public:
	Date(int year = 2024, int month = 1, int day = 1);
	void Print()const;
	Date& operator+=(int day);
	Date operator+(int day) const;
	Date& operator-=(int day);
	Date operator-(int day) const;
	bool operator<(const Date& date) const;
	bool operator==(const Date& date) const;
	bool operator>(const Date& date) const;
	bool operator>=(const Date& date) const;
	bool operator<=(const Date& date) const;
	bool operator!=(const Date& date) const;
	int operator-(const Date& date) const;
	Date& operator++();
	Date operator++(int);
	Date& operator--();
	Date operator--(int);
	//ostream& operator<<(ostream& out);
	bool CheckDate() const;
	int GetMonthDay(int year, int month) const
	{
		static int MonthDay[13] = { -1,31,28,31,30,31,30,31,31,30,31,30,31 };
		if (month == 2 && (((year % 100 != 0) && (year % 4 == 0)) || (year % 400 == 0)))
		{
			return 29;
		}
		return MonthDay[month];
	}

private:
	int _year;
	int _month;
	int _day;
};


